<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>demo18-样式操作/scroll</title>
    <script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
    <style type="text/css">
        #btn{
            position: fixed;
            top: 50px;;
        }
    </style>

</head>
<body style="height: 8000px;">
    <button id="btn">弹出滚动条离顶部的距离</button>
</body>
</html>

<script>

    $('#btn').click(function () {
        alert($(window).scrollTop())
    })
</script>